<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>Core</title>
		<script src="../../py/system.js" type="text/javascript"></script>
		
		<script src="../../common/project/project.js" type="text/javascript"></script>
		<script src="../../common/assets/scripts/default.js" type="text/javascript"></script>
		<script src="../../common/assets/scripts/debug.js" type="text/javascript"></script>
	</head>
	<body>
		<script>
			
			var MYCLASS = new Class({
				types : [],
				xType: "MYCLASS",
				constructor: function MYCLASSCTR(args){
					log(args + "    MYCLASS 构造");
					this.__assert = args;
				}
			});
			
			var MYCLASS2 = MYCLASS.extend({
				values : [],
				xType: "MYCLASS2",
				constructor: function MYCLASS2CTR(args){
					this.base('constructor', args);
					log(args + "    MYCLASS2 构造");
				}
			});
			
			var MYCLASS3 = MYCLASS2.extend({
				values : [],
				xType: "MYCLASS3",
				constructor: function MYCLASS3CTR(args){
					this.base('constructor', args);
					log(args + "    MYCLASS3 构造");
				}
			});
			
			var MYCLASS4 = MYCLASS3.extend({
				
				xType: "MYCLASS4",
				
				a: function(a,b){
					log("MYCLASS3->", a, b);
					this.__assert = a + b;
					return this;
				}
			});
			
			var MYCLASS5 = MYCLASS4.extend({
				
				xType: "MYCLASS5",
				
				a: function(a,b){
					return this.base('a', a, b);
				}
				
			});
			
			var MYCLASS6 = MYCLASS5.extend({
				
				xType: "MYCLASS6",
				
				a: function(a,b){
					return this.base('a', arguments);
				}
			});
			
			
			var fns = [
				["基本的类的创建", function(){
					assert(new MYCLASS6("3").__assert == "3");
				 }],
				["重载", function(){
					assert(new MYCLASS5().a(4,5).__assert == 9);
				}],
				["事件", function(){ 
					var MYCLASS = new Class({
						constructor: function(){
							
						}
					});
					
					MYCLASS.addEvents({
						"click": {
							add: log,
							remove: log
						}
					});
					
					var instance = new MYCLASS(), flag = false;
					instance.on("click", function(){
						log("被点击");
						flag = true;
					});
					instance.trigger("click");
					assert(flag);
				}],
				["事件的继承", function(){
					var MYCLASS = new Class,
						MYSCLASS = MYCLASS.extend(),
						flag = false;
					
					MYCLASS.addEvents({
						"click": {
							add: function(){
								flag = true;
							},
							remove: log
						}
					});
					
					new MYSCLASS().on('click', log);
					
					assert(flag);
				}]
			];
			
		</script>
	</body>
</html>
